/**
 * 
 */
package com.freecsim.sas.core.internal;

import java.util.Enumeration;
import java.util.Properties;

import com.freecsim.sas.core.services.ServiceConfigure;
import com.freecsim.sas.core.services.ServiceContext;

/**
 * @author wucj
 *
 */
public class InnerServiceConfigure implements ServiceConfigure {
	
	/**
	 * ServiceContext对象
	 */
	private ServiceContext context;

	/**
	 * 初始化参数
	 */
	private Properties initParamerters = new Properties();
	
	/*
	 * (non-Javadoc)
	 * @see com.freecsim.server.framework.core.services.ServiceConfigure#getInitParameter(java.lang.String)
	 */
	public String getInitParameter(String name) {
		return initParamerters.getProperty(name);
	}
	
	/**
	 * 设置初始化参数
	 * @param properties
	 */
	public void setInitParameter(Properties paramters){
		initParamerters = paramters;
	}

	/*
	 * (non-Javadoc)
	 * @see com.freecsim.server.framework.core.services.ServiceConfigure#getInitParameterNames()
	 */
	public Enumeration getInitParameterNames() {
		return initParamerters.keys();
	}

	/*
	 * (non-Javadoc)
	 * @see com.freecsim.server.framework.core.services.ServiceConfigure#getServiceName()
	 */
	public String getServiceName() {
		return String.valueOf(context.getAttribute("name"));
	}

	/*
	 * (non-Javadoc)
	 * @see com.freecsim.server.framework.core.services.ServiceConfigure#getServiceContext()
	 */
	public ServiceContext getServiceContext() {
		return context;
	}
	
	/**
	 * 设置服务上下文对象
	 * @param context
	 */
	public void setServiceContext(ServiceContext context){
		this.context = context;
	}
}
